<template>
  <transition name="el-fade-in-linear">
    <router-view />
  </transition>
</template>

<script>
export default {
  watch: {
  },
  created () {
    this.setState()
  },
  methods: {
    /* wf_Huang 2019/11/19 0019 防止刷新丢失数据 */
    setState () {
      // 存储
      // this.$store.state.openid = 88833888
      // localStorage.setItem('stateData', JSON.stringify(this.$store.state))
      const data = JSON.parse(localStorage.getItem('stateData'))
      if (data) {
        data.contentTabs = []
        this.$router.push({ name: 'home' })
        this.$store.replaceState(Object.assign({}, this.$store.state, data))
        // 判断是不是要版本迭代清除缓存 大量存储参数时会遇到行添加的state 值无法生效的问题
        if (this.$store.state.version !== '1.0.0.0') {
          localStorage.removeItem('stateData')
        }
      }
    }
  }
}
</script>
